import java.util.*;
public class Text3 {
    public static void main(String[] args) {
        //第三题  点击消除  利用栈
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        String str = in.next();
        //利用栈
        Stack<Character> stack =  new Stack<>();
        //遍历字符串  和栈顶元素比较
        for(int i = 0; i < str.length(); i++) {
            char ch = str.charAt(i);
            if(stack.isEmpty() || ch != stack.peek()) {
                //入栈
                stack.push(ch);
            }else{
                stack.pop();
            }
        }

        //输出
        if(stack.isEmpty()) {
            System.out.print(0);
        }else{
            //再创建一个栈
            Stack<Character> stack1 =  new Stack<>();
            while(!stack.isEmpty()) {
                stack1.push(stack.pop());
            }
            while(!stack1.isEmpty()) {
                System.out.print(stack1.pop());
            }
        }
    }
}
